Method and system for efficient quantum ternary arithmetic

ABSTRACT

Ripple-carry and carry look-ahead adders for ternary addition and other operations include circuits that produce carry values or carry status indicators that can be stored on qutrit registers associated with input values to be processed. Inverse carry circuits are situated to reverse operations associated with the production of carry values or carry status indicators, and restored values are summed with corresponding carry values to produce ternary sums.

TECHNICAL FIELD

The disclosure pertains to circuits, circuit synthesis, and methods for quantum ternary arithmetic.

BACKGROUND

Quantum circuits for performing arithmetic operations are an essential part of key quantum algorithms such as Shor's factorization, discrete logarithm, hidden subgroup algorithms and others. The importance of quantum ternary logic for applications such as quantum key distribution has been understood since late 1980s. Recently, ternary arithmetic has become important in quantum computing due to potential architectural platforms grounded in ternary representation, for example in the metaplectic any on architecture. Ternary quantum logic may also be relevant for other architectural platforms such as quantum dots, where higher energy levels can be used to store additional logic states. While ternary hardware architectures have been investigated, satisfactory circuits and procedures for ternary arithmetic and ternary quantum logic for algorithm and circuit compilation are generally unavailable.

SUMMARY

Ternary adders include a series of carry circuits that compute carry values associated with processing of two input values, followed by a series of inverse carry circuits that return qutrit register values to the input values. Sum values are then provided on qutrits associated with the input values. In some examples, carry status indicators are used to determine carry values so that ternary addition and other operations can be performed so that some stages can be executed in parallel. These ternary circuits and others can be synthesized in a supermetaplectic basis.

These and other features and aspects of the disclosed technology are set forth below with reference to the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A is a schematic diagram illustrating a ternary soft control gate ∨(U):|i,j

↔|i

⊗U^(i)|j

, wherein U is an arbitrary single qutrit gate.

FIG. 1B is a schematic diagram illustrating a ternary controlled-U gate.

FIG. 1C is a schematic diagram illustrating a ternary X-gate.

FIG. 1D is a schematic diagram illustrating a ternary sum gate.

FIG. 1E is a schematic diagram illustrating a ternary controlled-X gate.

FIG. 1F is a schematic diagram illustrating a ternary controlled-SUM gate.

FIG. 1G is a schematic diagram illustrating a carry status circuit that determines a carry status indicator C[0,1].

FIG. 1H is a schematic diagram illustrating a carry status circuit that determines a carry status indicator C[i,i+1].

FIG. 1I is a schematic diagram illustrating a merging circuit that determines carry status indicators C[i,j] based on carry stat indicators C[0,1] and C[i,i+1].

FIG. 1J is a schematic diagram illustrating an inverse of a carry status circuit that determines a carry status indicator C[0,1].

FIG. 1K is a schematic diagram illustrating an inverse of a carry status circuit that determines a carry status indicator C[i,i+1].

FIG. 1L is a schematic diagram illustrating an inverse of a merging circuit that determines carry status indicators C[i,j] based on carry status indicators C[0,1] and C[i,i+1] so as to permit restoration of trit values input to a carry look-ahead adder circuit.

FIG. 2 is a ternary arithmetic table illustrating carry trit values associated with various combinations of input trit values and an input carry trit value.

FIG. 3 illustrates operation of an S_(00,22) circuit.

FIG. 4 is a schematic diagram illustrating a quantum single trit carry circuit that produces a carry value based on input trit values stored in a quantum register and an input carry value received from a carry qutrit.

FIG. 5 is a schematic diagram illustrating a representative implementation of a quantum single trit carry circuit that produces a carry value based on input trit values stored in a quantum register.

FIG. 6 is a schematic diagram illustrating an inverse of the carry circuit of FIG. 5.

FIG. 7 is a schematic diagram illustrating a quantum ripple look-ahead adder for ternary addition of values obtained from two 3-qutrit quantum registers.

FIG. 8 is a schematic diagram illustrating an n-trit quantum ripple look-ahead adder for ternary addition.

FIG. 9 summarizes relationships between carry trit values c_(i) and c_(i+1).

FIG. 10 is a schematic diagram illustrating a quantum circuit that produces carry status indicators C[i,i+1] associated with i^(th) trits of two n-qutrit registers, wherein 0<i<n and n, i are positive integers.

FIG. 11 is a schematic diagram illustrating a quantum circuit that produces carry status indicators C[0,1] associated with two n-qutrit registers, wherein n is a positive integer.

FIG. 12 illustrates a merging operation for carry status indicators.

FIG. 13 is a schematic diagram illustrating a quantum merging circuit that determines carry status indicators C[i,j] based on carry status indicators C[i,k],C[k,j], wherein i, j, k are non-negative integers.

FIG. 14 is a schematic diagram of an “out of place” carry look-ahead quantum ternary addition circuit.

FIG. 15 is a schematic diagram of an “in-place” carry look-ahead quantum ternary addition circuit.

FIGS. 16A-16B are schematic diagrams of an “in-place” carry look-ahead quantum ternary addition circuit with comparison to a corresponding “out-of-place” circuit.

FIG. 17 is a schematic diagram of a quantum circuit that provides addition modulo 3^(n).

FIG. 18 is a schematic diagram illustrating a representative quantum method of ternary subtraction.

FIG. 19 is a schematic diagram illustrating a representative quantum ternary comparator.

FIG. 20 illustrates a method of quantum ternary comparison.

FIGS. 21-22 give constructions of the Horner gate and

(X) from one another.

FIG. 23 shows a construction of C(SUM) from

(X).

FIG. 24 shows a representative implementation of a circuit for S_(01,10).

FIG. 25 illustrates a representative circuit for ∨(∨(Z)) using the supermetaplectic basis.

FIG. 26 illustrates a representative circuit for C₂(Z) using the supermetaplectic basis.

FIG. 27 illustrates a representative classical computer that is configured to synthesize circuits for quantum ternary arithmetic and a quantum computing environment in which such circuits are implemented.

FIG. 28 is a block diagram of a representative classical computing environment.

DETAILED DESCRIPTION

As used in this application and in the claims, the singular forms “a,” “an,” and “the” include the plural forms unless the context clearly dictates otherwise. Additionally, the term “includes” means “comprises.” Further, the term “coupled” does not exclude the presence of intermediate elements between the coupled items.

The systems, apparatus, and methods described herein should not be construed as limiting in any way. Instead, the present disclosure is directed toward all novel and non-obvious features and aspects of the various disclosed embodiments, alone and in various combinations and sub-combinations with one another. The disclosed systems, methods, and apparatus are not limited to any specific aspect or feature or combinations thereof, nor do the disclosed systems, methods, and apparatus require that any one or more specific advantages be present or problems be solved. Any theories of operation are to facilitate explanation, but the disclosed systems, methods, and apparatus are not limited to such theories of operation.

Although the operations of some of the disclosed methods are described in a particular, sequential order for convenient presentation, it should be understood that this manner of description encompasses rearrangement, unless a particular ordering is required by specific language set forth below. For example, operations described sequentially may in some cases be rearranged or performed concurrently. Moreover, for the sake of simplicity, the attached figures may not show the various ways in which the disclosed systems, methods, and apparatus can be used in conjunction with other systems, methods, and apparatus. Additionally, the description sometimes uses terms like “produce” and “provide” to describe the disclosed methods. These terms are high-level abstractions of the actual operations that are performed. The actual operations that correspond to these terms will vary depending on the particular implementation and are readily discernible by one of ordinary skill in the art.

In some examples, values, procedures, or apparatus' are referred to as “lowest”, “best,” “minimum,” or the like. It will be appreciated that such descriptions are intended to indicate that a selection among many used functional alternatives can be made, and such selections need not be better, smaller, or otherwise preferable to other selections.

Disclosed herein are methods, apparatus, and quantum circuits pertaining to the synthesis of reversible ternary arithmetic circuits and corresponding circuits and methods. In addition, circuit synthesis using a supermetaplectic basis and circuits defined in this basis are disclosed. In some examples, ternary adders are described that are referred to as ripple carry adders and carry look-ahead adders. In one representative example, a ripple carry adder that adds 2 n-trit numbers requires only one ancilla qutrit and has a circuit depth of

(n); a corresponding carry save adder requires

(n) ancilla qutrits and has a circuit depth of

(log n).

Notation and Definitions

Quantum operations are described below with reference to one or more qutrits which represent three states. Qutrit operations can be described with reference to a qutrit computational basis |0

,|1

,|2

. Qutrits can be implemented in variety of ways using quantum mechanical systems that can assume three values. For convenient illustration, evolution of the state of a particular qutrit and couplings to other qutrits are shown in the drawings along lines so that evolution progresses from left to right. Corresponding matrix representations are obtained as products from right to left. Numbers can be represented by a series of ternary digits so that an n-trit number a can be expressed as a=a_(n-1)3^(n-1)+a_(n-2)3^(n-2)+ . . . +a₁3+a₀, wherein the a_(i) are referred to as trit values and possible values for a_(i) are 0, 1, and 2. A qutrit used in computation can be referred to as an ancilla or ancilla qutrit. A set of qutrits that are used to represent trit values associated with a multi-trit ternary number is referred to as a register or a quantum register.

Some gates used in the following description are defined below. Gates are typically described with reference to associated mathematical operations that are implemented by the gates. Circuit implementations of any particular operations are generally based on combinations of one or more basis gates selected from a set of basis gates. In qutrit arithmetic as used herein, arithmetic within a ket is modulo 3 arithmetic. In gate definitions, ζ_(n)=e^(2πi/n).

${\left. \left. {{{{\left. \left. {{{{\left. {{\left. \left. {{{{\left. \left. {{{\left. {{\left. \left. {{{\left. {{\left. \left. {{{\left. \left. {{{\left. \left. {{{\left. \left. {{\left. {{{{{{{{X:\left. {i\rangle}\rightarrow \right.}}i} + 1}\rangle},{i.e.},{X = \begin{pmatrix} 0 & 0 & 1 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix}}}{Z:\left| i \right.}}\rangle}\rightarrow{\zeta_{3}^{i}{{i + 1}\rangle}} \right.,{H:\left| i \right.}}\rangle}\rightarrow{\frac{1}{\sqrt{3}}{\sum_{j}\zeta_{3}^{ij}}} \right. \middle| j \right.\rangle}{S_{0,1}:\left| 0 \right.}}\rangle}\leftrightarrow \right. \middle| 1 \right.\rangle},{S_{00,22}:\left| 00 \right.}}\rangle}\leftrightarrow \right. \middle| 22 \right.\rangle}{{{{Soft}\mspace{14mu} {control}\mspace{14mu} {\Lambda (U)}}:\left| i \right.},j}}\rangle}\leftrightarrow \right. \middle| i \right.\rangle} \otimes U^{i}} \middle| j \right.\rangle}{{{{Hard}\mspace{14mu} {control}\mspace{14mu} {C(U)}}:\left| i \right.},j}}\rangle}\leftrightarrow \right. \middle| i \right.\rangle} \otimes U^{\delta_{i,c}}} \middle| j \right.\rangle}{{{{SUM} \equiv {\Lambda (X)}}:\left| i \right.},j}}\rangle}\rightarrow \right. \middle| i \right.,{i + j}}\rangle}{{{C(X)} = {{C_{c}(X)}:\left| i \right.}},j}}\rangle}\leftrightarrow \right. \middle| i \right.\rangle} \otimes U} \middle| i \right.,{j + \delta_{i,c}}}\rangle}{{{{HORNER} \equiv {\Lambda ({SUM})}}:\left| i \right.},j,k}}\rangle}\rightarrow \right. \middle| i \right.,j,{{ij} + k}}\rangle}{{{C({SUM})} = {{C_{c}({SUM})}:\left| i \right.}},j,k}}\rangle}\rightarrow \right. \middle| i \right.,j,{k + {j\; \delta_{i,c}}}}\rangle$

The gate C(X) is referred to as the controlled-increment gate and can be represented as:

${{C(X)} = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \end{pmatrix}},$

wherein 2-qutrit states a|00

+b|01

+c|02

+d|10

+e|11

+f|12

+g|20

+h|21

+i|22

are represented as column vectors of the form:

$\quad\begin{pmatrix} a \\ b \\ c \\ d \\ e \\ f \\ g \\ h \\ i \end{pmatrix}$

The single qutrit gate S_(0,1) is only one example as gates S_(0,2) and S_(1,2) can be similarly defined. These gates can be referred to as one trit swap gates.

The qutrit Clifford group is generated by the SUM, X, H, Q gates, wherein:

$H = {\begin{pmatrix} 1 & 1 & 1 \\ 1 & \zeta_{3} & \zeta_{3}^{2} \\ 1 & \zeta_{3}^{2} & \zeta_{3} \end{pmatrix}\mspace{14mu} {and}}$ $Q = {\begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & \zeta_{3} \end{pmatrix}.}$

-   Some of these gates are illustrated in FIGS. 1A-1F. The Clifford     gates X, Z, H, S_(0,1), and SUM can generally be implemented so as     to be computationally efficient or “cheap”; the non-Clifford gates     C(X), Horner, C(SUM), and S_(00,22) are generally relatively     expensive, and for this reason, the effectiveness of circuits and     methods can be based on the numbers and arrangements of these gates.     C(SUM), S_(00,22), and C(X) can each be constructed from 5 C(X)     gates; the number C(X) gates can be used as measure of complexity.     Gates such as S_(0,1) and S_(00,22) are referred to herein as single     trit swap gates and two trit swap gates, respectively. -   Some additional gates used in carry look-ahead circuits are     illustrated in FIGS. 1G-1I. Carry status gates AdjC₀ and AdjC and a     merge gate M are discussed below with reference to carry look-ahead     adders. Graphical representations are shown in FIGS. 1G-1I; inverses     are shown in FIGS. 1J-1L. Filled-in rectangles indicate that the     associated qutrit values can be changed by application of the gate;     blank boxes indicate qutrit values that are unchanged. -   Any of the above gates can have various implementations depending on     a basis gate set to be used.

Ternary Adders

Disclosed below are circuits and methods for adding n-trit numbers a, b using carry trits c_(i). The approaches described are referred as ripple carry adders and carry look-ahead adders which can be implemented using the gates C(X), C(SUM), C(S_(0,1)), S_(00,22). The gates C(SUM), C(S_(0,1)), S_(00,22) can be constructed from C(X) and Clifford operations. However, these gates can be otherwise implemented, as may be preferred.

Ripple Carry Adders

For ternary adders described herein, a carry trit c_(i) can have a value of 0 or 1, but never 2. FIG. 2 shows combinations of trit values a_(i),b_(i) and carry values that are associated with carry trit values c_(i+1). For a carry trit value c_(i)=2 (which does not occur in trit addition), the carry trit value c_(i+1) is defined to be c_(i+1)=2. With this definition, c_(i+1) is a balanced function, i.e., there are the same number of inputs corresponding to each output. As illustrated in FIG. 2, c_(i+1) is the same as c_(i) for all but six inputs, the last three in the columns c_(i)=0 and c_(i)=1. For each of these inputs, c_(i+1)=1−c_(i). Applying the gate S_(00,22) to qutrits associated with a_(i),b_(i) carries out the transformation shown in FIG. 3. The transformed values correspond to the set {(a,b,c)∈({0,1,2}³:a+b=c,c≠2}. A reversible circuit, referred to as Carry or a Carry Circuit, is defined that receives values a_(i),b_(i) and a carry c_(i) and produces a carry c_(i+1) in the qutrit associated with b_(i). In other examples, the carry value can be stored in qutrits associated with either summand, or partially in qutrits associated with each summand.

With reference to FIG. 4, a representative carry circuit 400 (a single trit carry adder) based on the above is coupled to qutrits 402, 407 that are associated with trit values a_(i),b_(i) to be added, and a qutrit 404 is used for an input carry value c_(i). The carry circuit 400 provides the qutrits 404, 402 with values associated with functions ƒ(a_(i),b_(i),c_(i)),g(a_(i),b_(i),c_(i)) of the input trit values and the input carry value, and the qutrit 407 (associated with the input trit values) provides an output carry value c_(i+1). As discussed below, an inverse carry circuit be coupled to a carry circuit such as the circuit 400 so that trit values a_(i),b_(i) are available.

Referring to FIG. 5, a representative carry-adder circuit 500 is coupled to qutrits 502, 503 that are associated with values a_(i),b_(i) and a qutrit 504 associated with a carry value c_(i). A two qutrit swap gate 506 is coupled to the qutrits 502, 503 and a SUM gate 508 produces a sum a_(i)+b_(i) at the qutrit 503 followed by a SUM gate 510 that produces a sum a_(i)+b_(i)+c_(i) at the qutrit 503. A one trit swap gate S_(0,1) 510 is coupled to the qutrits 503, 504 followed by SWAP gates 512, 514 that are coupled to qutrits 502, 504 and 502, 503, respectively. A carry value c_(i+1) is then available at the qutrit 503 and function values ƒ(a_(i),b_(i),c_(i)),g(a_(i),b_(i),c_(i)) are available at the qutrits 504, 502, respectively. The values of the functions ƒ(a_(i),b_(i),c_(i)),g(a_(i),b_(i),c_(i)) appear as outputs of the carry circuit 500 as shown, but these values can be processed to return input values as needed using inverse operations as discussed below. FIG. 6 illustrates an inverse carry circuit 600.

Referring to FIG. 7, a three-trit quantum adder 700 includes input qutrits 702, 704, 706 that form a three-trit register and that are associated with low, medium, and high trit values a₀,a₁,a₂, respectively. The three-trit quantum adder 700 also includes input qutrits 703, 705, 707 that form a three-trit register and that are associated with low, medium, and high trit values b₀,b₁,b₂, respectively.

A first carry-adder circuit 712 is coupled to receive a carry value c₀ and low order trit values a₀,b₀ and produce a carry value c₁ on the qutrit 703. A second carry-adder circuit 714 is coupled to the first carry-adder circuit 712 and to medium trit values a₁,b₁ followed by a third carry circuit 716 that is coupled to the second carry-adder circuit 714 and high trit values a₂,b₂. In this way, carry values c₁ and c₂ are produced on the qutrits 705, 707. A SUM gate 718 couples the carry trit value c₂ as an overflow trit value s₃ to an ancilla qutrit 720.

An inverse carry-adder circuit 722 is coupled to the qutrits 706, 706, 707 to restore input trit values a₂, b₂ and a SUM circuit 724 is coupled to the qutrits 706, 707 to produce a sum a₂+b₂; a SUM circuit 726 is coupled to the qutrits 705, 707 to produce a sum a₂+b₂+c₂ that is provided on the qutrit 707 as a high sum trit value s₂.

An inverse carry-adder circuit 730 is coupled to the qutrits 703, 704, 705 to restore input trit values a₁, b₁. A SUM circuit 732 is coupled to the qutrits 704, 705 to produce a sum a₁+b₁; a SUM circuit 734 is coupled to the qutrits 703, 704 to produce a sum a₁+b₁+c₁ that is provided on the qutrit 703 as medium sum trit value s₁.

An inverse carry-adder circuit 740 is coupled to the qutrits 710, 702, 703 to restore input trit values a₀, b₀. SUM circuits 742, 744 are coupled to the qutrits 702, 703 to produce a sum a₀+b₀+c₀ that is provided on the qutrit 703 as a low sum trit value s₀. In some cases, the input carry value is assumed to be zero and the SUM circuit 744 can be omitted.

As shown in FIG. 7, function values ƒ(a_(i),b_(i),c_(i)),g(a_(i),b_(i),c_(i)) produced by carry-adder circuits along with carry values are processed by inverse carry adder circuits so as to permit recovery of input values for addition operations. In the example of FIG. 7, a sum is stored in qubits associated with an input summand b; in other examples, a sum can be stored in qubits associated with summand a or in some qutrits of each of the summands a and b.

FIG. 8 illustrates a ripple-carry adder 800 that provides ternary addition of n-trit ternary numbers. Carry-adder circuits 802 _(j), j=1, . . . , n are coupled to receive sum and carry values from a prior carry-adder circuit in the series, The carry-adder circuit 802 _(n) producers a carry value (or sum value) s_(n) corresponding to an overflow. Each of the carry-adder circuits 802 _(j) is associated with a corresponding inverse carry adder circuit 804 _(j) and a sum circuit 806 _(j).

Carry Look-Ahead Adders

In the ripple-carry adder, a carry c_(i+1) is computed after the value of c_(i) has been obtained, and thus the overall depth of the circuit is in O(n). One protocol to reduce the depth is a ternary carry look-ahead adder, which can compute all carry trits in depth O(log n) by introducing extra O(n) ancillas.

Quantum ternary adders can take advantage of relations between c_(i+1) and c_(i), or more generally, between c_(i) and c_(j) for i≠j. For instance, if a_(i)+b_(i)=2, then c_(i+1)=c_(i), i.e., the carry trit remains unchanged. If a_(i)+b_(i)=1, then c_(i+1)=0 regardless of the value of c_(i), Relationships between carry trits and a_(i),b_(i) are summarized in FIG. 9. Note that c₀=0 and thus when i=0, the column c_(i+)=c_(i) in FIG. 9 becomes c₁=c₀=0. For 0≤i<j≤n, a carry status indicator C[i, j] is defined as:

-   -   0, for all c_(j)=0     -   1, for all c_(j)=1     -   2, for all c_(i)=c_(j)     -   c_(j), for i=0

Carry Status Indicators C[i, j]

FIG. 10 illustrates a representative carry status circuit 1000 (AdjC) that determines carry status indicators C[i,i+1] for adjacent trits a_(i),b_(i+1). The carry-status circuit 1000 includes a SWAP gate 1002, a SUM gate 1004, and a one trit swap gate 1006; a carry value is output on a qutrit associated with an input trit value b_(i). The carry-status circuit includes one non-Clifford gate S_(00,22) and no ancilla.

To compute C[0,1], one ancilla, and two non-Clifford gates S_(00,22) and C(X) are needed. FIG. 11 illustrates a representative circuit 1100 (AdjC₀) that calculates C[0,1] and that includes a two trit swap gate S_(00,22) 1102, sum gates 1104, 1106, and SWAP gates 1108, 1110. In this example, C[0,1] is available on the qutrit associated with a summand b.

After computing the carry status indicators for any two adjacent indices, C[i,j] can be computed for arbitrary i≠j. For 0≤i<k<j≤n, C[i,j] can be obtained from C[i,k] and C[k,j] by a merging formula illustrated in FIG. 12. A representative merging circuit 1300 that implements this formula is illustrated in FIG. 13. Because AdjC and AdjC₀ depend only on a_(i),b_(i), all the C[i,i+1] can be obtained in one time slice.

Carry-forward computation can be described as follows. For i=0,1, . . . ,n−1 let B_(i) be a working register configured to be C[i,i+1] at the beginning, and let Z_(i+1) be the working registers initialized to |0

and which are used to store C[i,i+1]. n−ω(n)−└log n┘ ancillas X_(i) initialized to |0

are used. Three processes, namely, a P-process, a C-process, and a P⁻¹-process are used. Each process roughly contains └log n┘ rounds. In a P-process, all the carry status indicators of the form C[2^(t)m,2^(t)(m+1)] are computed and the results stored in the ancillas, except carry status indicators of the form C[0,2^(k)] which are written to Z[2^(k)].

There are └log n┘ rounds, each t=1, . . . ,└log n┘ corresponding to one round. In the t^(th) round (referred to as a P[t]-round), the status indicators C[2^(t)m,2^(t)(m+1)] m=0, . . . ,

$\left\lfloor {\frac{n}{2^{t}} - 1} \right\rfloor$

are computed. By the merging formula, C[2^(t)m,2^(t)(m+1)] can be obtained from C[2^(t−1)(2m),2^(t−1)(2m+1)] and [2^(t−1)(2m+1),2^(t−1)(2m+2)] both of which have been computed in round P[t−1]. Moreover, the merging circuit producing C[2^(t)m,2^(t)(m+1)] for different m's in the P[t]-round takes different carry status indicators in a P[t−1]-round as input. Note that the P[1]-round requires the carry status indicators C[i,i+1]'s in the registers B_(i). Therefore, in the P[t]-round, all the merging circuits computing C[2^(t)m,2^(t)(m+1)] can be made parallel, and their inputs only depend on the carry status indicators from the P[t−1]-round. Thus, the depth of the circuit in P-process is └log n┘, the number of ancillas needed is n−ω(n)−└log n┘, and the complexity is n−ω(n).

In C-processes, C[0,j] is computed into the register Z_(j), j=1, . . . ,n. This is performed in

$\left\lfloor {\log \frac{n}{3}} \right\rfloor + 1$

rounds. Note that the C[0,2^(k)]'s have already been obtained in a P-process, and are located in the desired positions. For

${t = \left\lfloor {\log \frac{n}{3}} \right\rfloor},$

. . . ,0, the C[t]-round consists of computing the carry status indicators C[0,2^(t)(2m+1)],m=1, . . . ,

$\left\lfloor {\frac{n}{2^{t + 1}} - \frac{1}{2}} \right\rfloor.$

Again, by the merging formula, C[0,2^(t)(2m+1)] is obtained from C[0,2^(t+1)m] and C[2^(t)(2m),2^(t)(2m+1)]. By induction, C[0,2^(t+1)m] has been obtained in earlier C-rounds if m is not a power of 2, and in the P[t+1+log m] round otherwise. Also C[2^(t)(2m),2^(t)(2m+1)] has been computed in the P[t]-round. Therefore, all the merging circuits in a C[t]-round can be executed in parallel. These circuits depend on the carry status indicators in the P[t]-round and C[k]-rounds, k≥t+1. If m is a power of 2, then the corresponding merging circuit also depends on C[0,2^(t+1)m] from the P[t+1+log m]-round. Thus, the circuit in C-process has a depth of

${\left\lfloor {\log \frac{n}{3}} \right\rfloor + 1},$

and the complexity is n−[log n]−1.

In a P⁻¹-process, the ancillas are set back to |0

and thus all the merging circuits in P-processes are reversed, except for those computing C[0,2^(k)]'s which are not stored in the ancillas. The P⁻¹-process consists of └log n┘−1 rounds. For t=└log n┘−1, . . . , 1, the P⁻¹[t]-round uncomputes C[2^(t)m,2^(t)(m+1)], m=1, . . . ,

$\left\lfloor \frac{n}{2^{t}} \right\rfloor - 1$

by using an inverse of the merging circuit. Note that in this process, all the C[0,2^(k)]'s are not needed. The process has a depth of [log n]−1 and the complexity of the circuit is n−ω(n)−[log n].

Most parts of C-processes and P⁻¹ processes can be executed in parallel. All the inputs to the C[t]-round which are not of the form C[0,2^(m)] only depend on C[k]-rounds, k≥t+1 and the P[t]-round. The inputs that are of the form C[0,2^(m)] are computed in a P[m]-round, but they are used in a corresponding P⁻¹ process. The P⁻¹[t+2] round only depends on the outputs in P[t+1]-round and P[t+2]-round. Thus the C[t]-round and the P⁻¹[t+2]-round can be performed simultaneously.

FIG. 14 illustrates an n-trit carry look-ahead ternary adder 1400 for n=10. A series 1402 of carry-status indicator circuits is coupled to respective qutrits a_(i),b_(i) of respective qutrit registers a, b that store summands a, b so as to produce carry-status indicators of the form C[i, i+1] on qutrits b_(i). As shown in FIG. 14, the series includes circuits such as AdjC and AdjC₀ so that qutrits for all i values are processed. A series of merging circuits 1404 is coupled to produce additional carry-status indicators in three P-rounds and two C-rounds. As a result, carry values of the form c_(0i) are communicated to qubits s_(i) of an ancilla qutrit register s. (Ancilla qutrits are initialized as 0's as shown in FIG. 14). A series of inverse merging circuits 1406 and a series 1408 of inverse carry-status circuits are coupled to restore summand values in the a_(i),b_(i) qutrits and a series 1410 of addition circuits provides sums s_(i)=a_(i)+b_(i)+c_(0i) for i=0, . . . ,n. For n-qutrit registers, i=n is an overflow value, shown in FIG. 14 as s_(x).

The example of FIG. 14 can be referred to as an “out-of-place” adder, as sum values are produced on ancilla qutrits. FIG. 15 illustrates another representative n-trit carry look-ahead ternary adder 1500 for n=10. The configuration of FIG. 15 is referred to as an “in-place adder” as the sum values appear on qutrits used to provide the input summands. In FIG. 15, the sum values appear in the b register. FIGS. 16A-16B are enlarged views of the circuit of FIG. 15 showing a comparison of processing with respect to the out of place adder (i.e., showing “In” steps” and “Out steps”). In contrast to FIG. 14, a series 1510 of adders is coupled to produce sums in the b register.

Out-of-Place Procedure

An Out-of-Place procedure for ternary addition is described below in which input summands a, b are obtained from n-qutrit registers A, B and Z is an ancilla register. (1) For 0<i≤n−1, run the circuit AdjC on A_(i),B_(i) which outputs C[i,i+1] to B_(i). Run AdjC₀ on A₀,B₀ and Z₀ with Z₀ as the ancilla, which outputs C[0,1] to B₀, C[0,1] is copied to Z₁ with the SUM gate. The circuit has a depth of 2, and it consist of n−1 AdjC circuits, one AdjC₀ circuit, and one SUM circuit. (2) Compute all the C[0,i]'s with the ancillas X_(i)'s and the merging circuit (and its inverse). At the end of this process, the ancillas are returned to 0, and Z_(i)=C[0,i],i=1, . . . ,n. Note that Z₁=C[0,1] is obtained in a prior step. This requires 3n−2ω(n)−2└log n┘−1 calls to the merging circuits, and has a circuit depth of

$\begin{matrix} {\left\lfloor {\log \; n} \right\rfloor + {\left\lfloor {{\log \frac{n}{3}} +} \right\rfloor 2.}} & (3) \end{matrix}$

Undo all the AdjC and AdjC₀ operations with corresponding inverse circuits to obtain B_(i)=b_(i),Z_(i)=C[0,i]=c_(i). The circuit has a depth of 2 and it consist of n−1 inverse AdjC circuits, one inverse AdjC₀ circuit, and one inverse SUM circuit. (4) Set Z_(i)=Z_(i)⊕A_(i)⊕B_(i), 0≤i≤n−1. This requires 2n SUM gates.

In-Place Procedure

Let 2 be the n-trit number with all 2's, namely 2=3^(n)−1. For two n-trit numbers a,b denote by a⊕b as the number obtained by trit-wise summation modulo 3 and denote by a′ the number obtained by replacing every trit a_(i) by 2−a_(i). Then, a⊕a′=2, and a+a′=3^(n)−1. Let c=c₀ . . . c_(n-1) be the sequence of the n low carry trits for a and b, and let s be the n low trits of a+b. Then, s=a+b (mod 3^(n)) and s=a⊕b⊕c. Also note that:

s′+a=3^(n)−1−s+a=3^(n)−1−b=b′(mod 3^(n)).

Let d=d₀ . . . d_(n-1) be the n low carry trits resulting from adding s′ and _(a). Then s′⊕a⊕d=b′, and

2⊕a⊕b⊕d=s⊕s′⊕a⊕b⊕d=s⊕b′⊕b= 2⊕a⊕b⊕c.

Therefore, c=d, i.e., the n low carry trits for a, b are the same as those for s′, a. This can be used to implement an in-place adder. For 0≤i≤n−1 let A_(i),B_(i) be the working registers initialized with a_(i),b_(i) respectively. 2n−ω(n)−[log n] ancillas are used, n of which are denoted Z₀,Z₁, . . . ,Z_(n-1) and the rest are X_(i)'s. Let Z_(n) be the working register which will store the high trit of a+b. All ancillas start with 0.

As described with reference to the Out-of-place Procedure steps (1)-(3), compute all carry trits C[0, j] into Z_(j),j=0, . . . ,n. The ancillas X_(i) and working registers A_(i),B_(i) are all returned to their initial configuration at the end of the process. This has a circuit depth of

${\left\lfloor {\log \; n} \right\rfloor + \left\lfloor {\log \frac{n}{3}} \right\rfloor + 6},$

with complexity of 5n−2ω(n)−2└log n┘+1. (2) For 0≤i≤n−1, let B_(i)=B_(i)⊕A_(i)⊕Z_(i) so that the register B_(i)'s store the n low trits of the sum. (3) Next, erase the n carry trits C[0,i]=c_(i),i=0, . . . ,n−1. For 0≤i≤n−2, let B_(i)=2−B_(i) with n−1 S_(0,2) gates. (4) Apply the inverse of the Out-of-place Procedure, Steps 1-3 on the A_(i),B_(i)'s for 0≤i≤n−2 to erase the carry trits c_(j) stored in Z_(j),j=0, . . . ,n−1. For 0≤i≤n−2 let B_(i)=2−B_(i). This can be done by n−1 S_(0,2) gates.

EXAMPLE Quantum Ternary Subtraction

With quantum ternary addition circuits such as disclosed above, quantum ternary subtraction can also be carried out. Referring to FIG. 17, a method 1700 of subtraction of two n-trit numbers a,b includes converting a to a′ at 1702 by replacing each a_(i) with 2−a_(i). i.e., a′=3^(n)−a−1. At 1704, a sum a′+b is obtained. At 1706, this sum is converted as follows to produce the difference:

(a′+b)′=(3^(n)−1−a−b)′=3^(n)−1−(3^(n)−1−a−b)=a−b.

This difference is output at 1708.

A representative quantum ternary subtraction circuit 1800 is illustrated in FIG. 18. An a register storing a ternary a value is coupled to a conversion circuit 1802 that produces an output a′=3^(n)−a−1. This output and a ternary value from a b register are coupled to an adder 1804 to produce an output a′+b that is coupled to a conversion circuit to produce the difference. As shown in FIG. 18, the a register is used to store the sum a′+b, but the b register or an ancilla register can be used instead.

EXAMPLE Quantum Ternary Comparison

A comparison of two ternary numbers a, b can be determined using ternary subtraction as discussed above, but a comparison can also be obtained with less complexity as only a high (most significant) trit value of a−b is needed. Referring to FIG. 19, a comparison method 1900 includes converting a ternary value a to a′=3^(n)−a−1 at 1902. At 1904, value of a most significant (high) trit value of a sum a′+b is determined. At 1906, if this trit value is 0, then difference a−b≥0 as output at 1908; otherwise, a−b<0 as output at 1910.

In the carry look-ahead adder, again a is first converted to a′. To compute a sum a′+b the circuit sequentially generates all the carry status indicators. However, since only a high trit c_(n)=C[0,n] is needed, a more efficient circuit can be used to implement the comparison.

As discussed above, in a P-process, all the carry status indicators of the form C[2^(t)m,2^(t)(m+1)], and in particular, any C[0,2^(k)] are obtained. If n=2^(k) for some k then c_(n) is obtained at the end of a P-process and there is no need to go through a C-process. Instead, c_(n) is copied into the register storing the result, and the P-process is undone.

In general, let k=┌log n┐; a and b are padded by adding zeros to make them 2^(k)-trit numbers, and the circuit described above is used to compare a and b. For convenience, the padded numbers are referred to herein as a and b as well. For 0≤i≤n−1, let A_(i)=a_(i),B_(i)=b_(i) be the working registers, and let R be the register which will store the result of the comparison. 2^(k)+2(2^(k)−n) ancillas are needed, among which 2(2^(k)−n) are used to hold the extra zeros in from of a and b, one is denoted by Z₀ as the ancilla to the AdjC₀ circuit, and the rest are denoted by X_(i).

Note that after padding s a and b with zeros, the carry status indicators C[i, j] for n≤i<j≤2^(k) are known before compilation, thus their values can be stored in the registers and there is no need to recompute them later.

Carry Look-Ahead Comparison

In a first step, convert a to a′. This requires 2^(k)S_(0,2) gates. In a second step, for 0<i≤n−1, run the circuit AdjC on A_(i),B_(i) which outputs C[i,i+1] to B_(i). Run AdjC₀ on A₀,B₀ and Z₀ with Z₀ as the ancilla, which outputs C[0,1] to B₀. The circuit has a depth of 2 and consists of n−1 AdjC circuits and one AdjC₀ circuit. Third, perform the P-process in discussed above to compute all C[2^(t)m,2^(t)(m+1)] that are not known before compilation into the ancillary registers X_(i). Since the Z_(i) registers are not available, all C[0,2^(m)]'s are also written to the X_(i) registers. The depth of the circuit is k, and the complexity is 2^(k)−ω(2^(k))−(2^(k)−n−ω(2^(k)−n))=n+ω(2^(k)−n)−1. Fourth, copy c₂ _(k) to the result register R. Fifth, undo steps 3, 2, and 1. Total depth of such a circuit is 2k+4=2┌log n┐+4 and it has the complexity of 4n+2ω(2^(k)−n)=4n+2ω(2^(┌log n┐)−n). The number of ancillas used is 3·2^(┌log n┐)−2n.

EXAMPLE Quantum Ternary Modular Addition

Referring to FIG. 20, an modular addition circuit 2000 for 3-qutrit addition is similar to the circuit of FIG. 7 but a higher order sum trit (or overflow trit) need not be computed so the carry-adder circuits 716, the adder circuit 718, and the inverse carry-adder circuit 720 are not needed. In addition, the ancilla qutrit 720 used to store s₃ can be omitted. Modular addition circuits for other values of n are similar. Carry-save modular addition circuits are similar to the carry-save addition circuits of FIGS. 14-16B but only the low n−1 trits are needed, i.e., only a₀, . . . a_(n-2),b₀, . . . b_(n-2) are used as inputs.

Techniques of Constructing Quantum Gates

The methods and apparatus for quantum ternary arithmetic are described above with reference to two types of quantum ternary adders. The building blocks of these adder circuits include the Carry circuit C, the carry status circuits AdjC,AdjC₀ that compute carry status indicators, and the merging circuit M. The four non-Clifford gates used in these circuits are S_(00,22), C(S_(0,1)), C(X), C(SUM). It suffices to have

(X) along with the Clifford gates to produce the other three non-Clifford gates exactly. Algebraic expressions of these gates can be used. As shown below,

(X) and the Horner gate are equivalent up to Clifford gates, and that all other non-Clifford gates can be obtained from

(X).

A universal gate set defined below is referred to as a supermetaplectic basis, which is a qutrit analog of the qubit Clifford+T gate set. It is also shown that

(X) and the Horner gate can both be implemented exactly over the supermetaplectic basis. Therefore, with the supermetaplectic basis, ternary circuits for arithmetic can be realized exactly.

Construction of Reversible Gates Using Polynomial Expressions

Let F₃ be the field with three elements {0,1,2}. Then any n-qutrit reversible gate can be represented as a map F₃ ^(n)

F₃ ^(n) or a sequence of n functions F₃ ^(n)

F₃ if each |i

is identified with 0, 1, 2. Reversible gates have polynomial representations and these polynomial representations can be used to construct one reversible gate from another. Note that 0²=0,1²=2²=1mod 3, and thus δ_(i,0)=1−i² mod 3. By default, arithmetic within a ket is taken modulo 3. The following is a list of polynomial expressions associated with some non-Clifford gates.

SUM=∨(X): |i,j

|i,i+j

  (soft control)

C ₀(X): |i,j

|i,j+δ _(i,0)

=|i,j−i ²+1

  (hard control)

Horner:=Λ(Λ(X)):|i,j,k

|i,j,ij+k

  (soft control)

C ₀(SUM):|i,j,k

|i,j,k+(1−i ²)j

  (hard control)

As shown above, if a qutrit works as a soft control, then it contributes a linear factor in the expression of the target qutrit, while a hard control qutrit contributes a quadratic factor. Define C′(X): |i,j

|i,j

+i² so that C′(X)=(I⊗X)C₀(X)⁻¹ is equivalent to C(X).

(X) is used below for the construction of other gates.

The relation between the expressions of the Horner gate and

(X) resembles that of a bilinear form and a quadratic form, which are equivalent. This suggests that these gates are equivalent. FIGS. 21-22 give constructions of the Horner gate and

(X) from one another. FIG. 23 shows a construction of C(SUM) from

(X).

C(S_(0,1)) and S_(00,22) can be similarly implemented. Note that the circuit of FIG. 24 shows an implementation of S_(01,10). In addition,

S _(00,22)=SUM⁻¹(X ⁻¹ ⊗I)S _(01,10)(X⊗I)SUM.

C ₀(S _(0,1))=SUM_(2,1) ⁻¹(X ⁻¹ ⊗X ⁻¹)S _(00,22)(X⊗X)SUM_(2,1).

Supermetaplectic Basis

Recall that

is the qutrit Clifford group generated H, Q, X and SUM. Some other gates in

are Z and ∨(Z), wherein Z=diag(1,ζ₃,ζ₃ ²) and ∨(Z)=(I⊗H)SUM(I⊗H⁻¹). It can be directly confirmed that ∨(Z) can be expressed as:

∨(Z): |i,j

ζ ₃ ^(ij) |i,j

The metaplectic basis is defined as a universal qutrit gate set

+diag(1,1,−1) or equivalently

+diag(1,ζ₆,ζ₆ ²). In spite of its universality, it is unlikely that all the reversible gates can be implemented exactly over the metaplectic basis. To provide superior exact implementations, the order of the root of unity used in defining the non-Clifford diagonal gate is increased, and P₉ is defined as 1-qutrit diagonal gate diag(1,ζ₉,ζ₉ ²). The supermetaplectic gate set is then defined to be the universal gate set

+P₉. All reversible gates can be constructed exactly over the supermetaplectic gate set.

Construction of Diagonal Gates Using Polynomial Expressions

Polynomial expressions can be used in constructing new quantum gates in the supermetaplectic basis. Let D be the group generated by the reversible gates in

together with the diagonal gates ∨(Z) and P₉.

The group of reversible gates in

is generated by SUM, X, S_(1,2). It can be shown that the set {SUM, X, S_(1,2)} generates a maximal subgroup, which is isomorphic to ≃GL(n,F₃)

F₃ ^(n), of the group of reversible gates (the permutation group) for any number n of qutrits.

A function ƒ: F₃ ^(n)

F₃ is called affine linear if ƒ(i₁, . . . ,i_(n))=a₁i₁+ . . . +a_(n)i_(n)+b, wherein a₁, . . . ,a_(n),b∈F₃. Let F_(n) be the set of all affine linear functions from F₃ ^(n) to F₃. Note that generators of D have the following algebraic expressions:

∨(Z)|i,j

=ζ ₃ ^(ij) |i,j

,P ₉ |i

=ζ ₉ ^(i) |i

X|i

=|i+1

,S _(1,2) |i

=|2i

,SUM|i,j

=|i,i+j

The reversible gates X,S_(1,2) and SUM all have affine linear expressions. Any reversible gate with affine linear expressions can be expressed in terms of {S₁₂,X} and SUM. Therefore, the most general n-qutrit diagonal gate in D has the form:

$\left. {{i_{2},\ldots \mspace{14mu},i_{n}}\rangle}\mapsto{\zeta_{9}^{\sum\limits_{f \in \mathcal{F}_{n}}{A_{f}{f{({i_{1},\ldots \mspace{14mu},i_{n}})}}}}\zeta_{3}^{\sum\limits_{f,{g \in \mathcal{F}_{n}}}{B_{f,g}{f{({i_{1},\ldots \mspace{14mu},i_{n}})}}{g{({i_{1},\ldots \mspace{14mu},i_{n}})}}}}{{i_{2},\ldots \mspace{14mu},i_{n}}\rangle}} \right.$

wherein A_(f),B_(f,g) are integers.

As a representative example, ∨(∨(Z)) and C₂(Z) are shown to be contained in D.

∨(∨(Z)): |i,j,k

ζ ₃ ^(ijk) |i,j,k

C: |i,j

²|ζ₃ ^(jδ) ^(i,2)

|i,j

For n=3, the general expression above for an n-qutrit diagonal gates D can be written as:

${{L\left( {i,j,k} \right)} = {\zeta_{9}^{\sum\limits_{a,b,c,{d = 0}}^{2}{A_{a,b,c,d}{({{ai} + {bj} + {ck} + d})}}}\zeta_{3}^{{Bij} + {Cjk} + {Dik}}}},$

i,j,k∈F₃, wherein A_(a,b,c,d),B,C,D are integer parameters.

To construct ∨(∨(Z)), set L(i,j,k)=ζ₃ ^(ijk). Since ζ₉=ζ₃ ³, then the following equation is obtained:

${{{{{Equ}\left( {i,j,k} \right)}\text{:}\mspace{14mu} {\sum\limits_{a,b,c,d}{A_{a,b,c,d}\left( {{ai} + {bj} + {ck} + d} \right)}}} + {3\left( {{Bij} + {Cjk} + {Dik}} \right)}} = {3\; {{ijk}\left( {{mod}\mspace{14mu} 9} \right)}}},$

i,j,k∈F₃ Equ(i,j,k) is a system of 27 linear equations in the variables A_(a,b,c,d),B,C,D and can be solved for these variables. By direct calculation, one solution to the above system of equations is:

ζ₃^(ijk) = ζ₉^((1 + 2i + j + k) + 2(1 + 2 i + j + 2 k) + 6(2 + 2 i + j + 2 k) + 2(1 + 2 i + 2 j + k) + 6(2 + 2 i + 2 j + k) + 4(1 + 2 i + 2 j + 2 k) + 6(2 + 2 i + 2 j + 2 k))

Based on the above, a circuit realizing ∨(∨(Z)) can be obtained as shown in FIG. 25. FIG. 26 illustrates a circuit for C₂(Z) that can be found in a similar manner.

Note that ∨(∨(Z)) and C₂(Z) are related to the Horner gate and C₂(X), respectively, by the Clifford gate H, namely:

(I⊗H)C ₂(X)(I⊗H ⁺)=C ₂(Z)

(I⊗I⊗H)Horner(I⊗I⊗H ⁺)=∨(∨(Z))

Therefore, both of these gates can be implemented exactly over the supermetaplectic basis.

Quantum and Classical Processing Environments

With reference to FIG. 27, an exemplary system for implementing some aspects of the disclosed technology includes a computing environment 2700 that includes a quantum processing unit 2702 and one or more monitoring/measuring device(s) 2746. The quantum processor executes quantum circuits (such as the circuit ternary arithmetic circuits described above) that can be precompiled by classical compiler unit 2720 utilizing one or more classical processor(s) 2710.

With reference to FIG. 27, the compilation is the process of translation of a high-level description of a quantum algorithm into a sequence of quantum circuits. Such high-level description may be stored, as the case may be, on one or more external computer(s) 2760 outside the computing environment 2700 utilizing one or more memory and/or storage device(s) 2762, then downloaded as necessary into the computing environment 2700 via one or more communication connection(s) 2750. Alternatively, the classical compiler unit 2720 is coupled to a classical processor 2710 and a procedure library 2721 that contains some or all procedures or data necessary to implement the methods and circuits described above such as merging circuits, modular addition, comparison, and other ternary computations.

FIG. 28 and the following discussion are intended to provide a brief, general description of an exemplary computing environment in which the disclosed technology may be implemented. Although not required, the disclosed technology is described in the general context of computer executable instructions, such as program modules, being executed by a personal computer (PC). Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. Moreover, the disclosed technology may be implemented with other computer system configurations, including hand held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like. The disclosed technology may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.

Typically, a classical computing environment is coupled to a quantum computing environment, but a quantum computing environment is not shown in FIG. 28.

With reference to FIG. 28, an exemplary system for implementing the disclosed technology includes a general purpose computing device in the form of an exemplary conventional PC 2800, including one or more processing units 2802, a system memory 2804, and a system bus 2806 that couples various system components including the system memory 2804 to the one or more processing units 2802. The system bus 2806 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. The exemplary system memory 2804 includes read only memory (ROM) 2808 and random access memory (RAM) 2810. A basic input/output system (BIOS) 2812, containing the basic routines that help with the transfer of information between elements within the PC 2800, is stored in ROM 2808.

As shown in FIG. 28, a specification of a supermetaplectic basis and procedures for synthesis using this based are stored in a memory portion 2816. Instructions for specifying ternary arithmetic circuits are stored at 2818. Processor-executable instructions for solving equations that specify supermetaplectic basis specifications are stored at 2828.

The exemplary PC 2800 further includes one or more storage devices 2830 such as a hard disk drive for reading from and writing to a hard disk, a magnetic disk drive for reading from or writing to a removable magnetic disk, and an optical disk drive for reading from or writing to a removable optical disk (such as a CD-ROM or other optical media). Such storage devices can be connected to the system bus 2806 by a hard disk drive interface, a magnetic disk drive interface, and an optical drive interface, respectively. The drives and their associated computer readable media provide nonvolatile storage of computer-readable instructions, data structures, program modules, and other data for the PC 2800. Other types of computer-readable media which can store data that is accessible by a PC, such as magnetic cassettes, flash memory cards, digital video disks, CDs, DVDs, RAMs, ROMs, and the like, may also be used in the exemplary operating environment.

A number of program modules may be stored in the storage devices 2830 including an operating system, one or more application programs, other program modules, and program data. Storage of circuit designs, and computer-executable instructions for circuit synthesis and configuring a quantum computer based on such circuits can be stored in the storage devices 2830 as well as or in addition to the memory 2804. A user may enter commands and information into the PC 2800 through one or more input devices 2840 such as a keyboard and a pointing device such as a mouse. Other input devices may include a digital camera, microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the one or more processing units 2802 through a serial port interface that is coupled to the system bus 2806, but may be connected by other interfaces such as a parallel port, game port, or universal serial bus (USB). A monitor 2846 or other type of display device is also connected to the system bus 2806 via an interface, such as a video adapter. Other peripheral output devices 2845, such as speakers and printers (not shown), may be included. In some cases, a user interface is displayed so that a user can input user preferences regarding circuit implementations.

The PC 2800 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 2860. In some examples, one or more network or communication connections 2850 are included. The remote computer 2860 may be another PC, a server, a router, a network PC, or a peer device or other common network node, and typically includes many or all of the elements described above relative to the PC 2800, although only a memory storage device 2862 has been illustrated in FIG. 28. The storage device 2862 can provide storage of ternary circuit specifications and supermetaplectic basis synthesis procedures. The personal computer 2800 and/or the remote computer 2860 can be connected to a logical a local area network (LAN) and a wide area network (WAN). Such networking environments are commonplace in offices, enterprise wide computer networks, intranets, and the Internet.

When used in a LAN networking environment, the PC 2800 is connected to the LAN through a network interface. When used in a WAN networking environment, the PC 2800 typically includes a modem or other means for establishing communications over the WAN, such as the Internet. In a networked environment, program modules depicted relative to the personal computer 2800, or portions thereof, may be stored in the remote memory storage device or other locations on the LAN or WAN. The network connections shown are exemplary, and other means of establishing a communications link between the computers may be used.

In some examples, a logic device such as a field programmable gate array, other programmable logic device (PLD), an application specific integrated circuit can be used, and a general purpose processor is not necessary. As used herein, processor generally refers to logic devices that execute instructions that can be coupled to the logic device or fixed in the logic device. In some cases, logic devices include memory portions, but memory can be provided externally, as may be convenient. In addition, multiple logic devices can be arranged for parallel processing. 

1.-15. (canceled)
 16. A ripple carry circuit for quantum ternary addition, comprising: a first n-qutrit register that includes n qutrits, the n qutrits including a least significant qutrit, at least one intermediate qutrit, and a most significant qutrit that store a least significant trit value, at least one intermediate trit value, and a most significant trit value, respectively, wherein n is a positive integer; a second n-qutrit register that includes n qutrits, the n qutrits including a least significant qutrit, at least one intermediate qutrit, and a most significant qutrit that store a least significant trit value, at least one intermediate trit value, and a most significant trit value, respectively; a carry qutrit; a first carry circuit coupled to the least significant qutrit of the first n-qutrit register and the least significant qutrit second n-qutrit register so as to produce and store a carry value associated with a sum of the least significant trit values stored in the first and second n-qutrit quantum registers; n−2 carry circuits serially coupled to respective intermediate qutrits of the first n-qutrit register and the second n-qutrit register, wherein a k^(th) carry circuit is coupled to a preceding carry circuit so as to receive a carry value associated with a sum of (k−1)^(th) trit values and to k^(th) qutrits of the first and second n-qubit registers so as to receive k^(th) trit values stored in the first and second n-qubit registers, the k^(th) carry circuit producing and storing a k^(th) carry value in a k^(th) qutrit of the second n-qutrit register; an n^(th) carry circuit coupled to an n^(th) qutrit of the first n-qutrit register and an n^(th) qutrit of the second n-qutrit register so as to receive nth trit values stored in the first and second n-qubit registers, wherein the n^(th) carry circuit is coupled to an (n−1)^(th) carry circuit so as to receive an (n−1)^(th) carry value, the n^(th) carry circuit producing an n^(th) carry value based a sum of the n^(th) trit values in stored in the first and second n-qubit registers and the (n−1)^(th) carry value; and an adder circuit coupled to the n^(th) carry circuit so as to couple the n^(th) carry value to the carry qubit.
 17. The ripple carry adder circuit of claim 16, further comprising n inverse carry circuits and n adder circuits, wherein: a first inverse carry circuit is coupled to the n^(th) carry circuit and a 1^(st) adder circuit of the n adder circuits so as to produce a sum of the n^(th) trit values from the n^(th) qutrit of the first and second n-qutrit registers and the carry value from the (n−1)^(th) carry circuit, and the k^(th) inverse carry circuit is coupled to the (n−k)^(th) carry circuit and a preceding inverse carry circuit and a k^(th) adder circuit so as to produce a sum of the (n−k)^(th) trit values from the (n−k)^(th) qutrit of the first and second n-qutrit registers and the carry value from the preceding carry circuit, wherein k is an integer k=1, . . . , n−1.
 18. The ripple carry adder circuit of claim 17, wherein each of the n adders includes a first sum gate coupling the kth qutrit of the first n-qutrit register to the kth qutrit of the second n-qutrit register and a second sum gate coupling the (k−1)^(th) qutrit of the second n-qutrit register to the k^(th) qutrit of the second n-qutrit register.
 19. The ripple carry adder circuit of claim 17, wherein each of the n adders includes a first sum gate coupling the k^(th) qutrit of the first n-qutrit register to the kth qutrit of the second n-qutrit register.
 20. The ripple carry adder circuit of claim 16, further comprising n inverse carry circuits and n−1 adder circuits, wherein: a first inverse carry circuit is coupled to the n^(th) carry circuit and a 1^(st) adder circuit of the n adder circuits so as to produce a sum of the n^(th) trit values from the n^(th) qutrit of the first and second n-qutrit registers and the carry value from the (n−1)^(th) carry circuit, and the k^(th) inverse carry circuit is coupled to the (n−k)^(th) carry circuit and a preceding inverse carry circuit and a k^(th) adder circuit so as to produce a sum of the (n−k)^(th) trit values from the (n−k)^(th) qutrit of the first and second n-qutrit registers and the carry value from the preceding carry circuit, wherein k is an integer k=1, . . . , n−2.
 21. The ripple carry adder circuit of claim 20, further comprising an n^(th) adder circuit coupled to the n^(th) inverse carry circuit, wherein the n^(th) adder circuit is coupled to the (n−1)^(th) inverse carry so as to produce a sum of the 0^(th) trit values from the 0^(th) qutrit of the first and second n-qutrit registers.
 22. The ripple carry adder circuit of claim 21, wherein the n^(th) adder circuit is coupled to the (n−1)^(th) inverse carry so as to produce the sum of the 0^(th) trit values from the 0^(th) qutrit of the first and second n-qutrit registers on the 0^(th) qutrit of the second register.
 23. A method of ternary addition, comprising: representing a first n-trit ternary number and a second n-trit ternary number in a first n-qutrit quantum register and a second n-qutrit quantum register, respectively; based on trit values in the first n-qutrit quantum register and the second n-trit quantum register, establishing carry status indicators for trits having adjacent indices on corresponding ancillary qutrits; merging the carry status indicators to find carry status indicator values for non-adjacent indices; and based on the merged carry status indicators, storing a sum of the first and second n-trit ternary numbers in an output quantum register.
 24. The method of ternary addition of claim 23, wherein the sum of the first and second n-trit ternary numbers is stored in at least one of the first n-qutrit quantum register and the second n-qutrit register.
 25. The method of ternary addition of claim 23, wherein the sum of the first and second n-trit ternary numbers is stored in an n-qutrit ancilla register.
 26. The method of ternary addition of claim 23, wherein the merging of the carry status indicators to find carry status indicator values for non-adjacent indices alters values stored in the first n-qutrit register and the second n-qutrit register, and further comprising inverse merging so as to restore the first n-trit ternary number to the first n-qutrit register and the second n-trit ternary number to the second n-qutrit register.
 27. The method of ternary addition of claim 23, wherein the merging the carry status indicators to find carry status indicator values for non-adjacent indices comprises determining carry status indicators associated with a least significant trit of at least one the first n-trit ternary number and the second n-trit ternary number and a most significant trit of at least one of the second n-trit ternary number and the first n-trit ternary number, respectively.
 28. A ternary quantum adder for adding n-trit numbers, wherein n is a positive integer, comprising: n carry status indicator circuits coupled to respective qutrits of a first n-qutrit register and a second n-qutrit register associated with a first summand and a second summand, respectively, so as to determine carry status indicator values associated with adjacent qutrits and store the carry status indicator values on qutrits of at least one ancilla register; a plurality of merging circuits coupled to the qutrits of the first register, the second register, and the at least one ancilla register so as to store carry status indicators values associated with a coupling of the low qutrits of at least one of the first n-qutrit register and the second n-qutrit register to respective higher qutrits of at least one of the first quantum register and the second quantum register in the at least one ancilla register; and n pairs of quantum adder circuits coupled to the at least one ancilla qutrit and the qutrits of the first quantum register and the second quantum register so as to sum trit values of the corresponding qutrits of the first quantum register, the second quantum register, and the at least one ancilla qutrit to produce and store a ternary sum of the first summand and the second summand.
 29. The ternary quantum adder of claim 28, comprising a plurality of inverse merging circuits coupled to the qutrits of the first register, the second register, and the at least one ancilla register so as to receive values stored on the qutrits of the first register and the second register by at least one of the merging circuits so as to restore values associated with the first summand and the second summand.
 30. The ternary quantum adder of claim 28, wherein the ternary sum is stored in the at least one ancilla register.
 31. The ternary quantum adder of claim 30, wherein the ternary sum is stored in the at least one of the first n-qutrit register and the second n-qutrit register. 